$OpenBSD: patch-Makefile_PL,v 1.6 2014/12/21 13:32:54 benoit Exp $
--- Makefile.PL.orig	Fri Apr 17 05:54:44 2009
+++ Makefile.PL	Sun Dec 21 08:32:21 2014
@@ -34,7 +34,9 @@
   if ($^O =~ /win32/i) {
     cc_lib_links('FLAC_static');
   } else {
-    cc_lib_links('FLAC');
+    cc_inc_paths($ENV{'INCPATH'});
+    cc_lib_paths($ENV{'LIBPATH'});
+    cc_lib_links('FLAC', 'ogg');
     cc_optimize_flags('-Wall') if $Config::Config{'archname'} =~ /gnu/i;
   }
 
@@ -57,12 +59,12 @@
   my $libbase = 'lib' . substr($lib, 2) . $Config{lib_ext};
   my $libbase_so = 'lib' . substr($lib, 2) . "." . $Config{so};
 
-  for my $path (split(' ', $Config{libpth})) {
-    if (-f $path . '/' . $libbase) {
+  for my $path (split(' ', $ENV{'LIBPATH'})) {
+    if (-f $path . '/' . $libbase_so) {
       print "$path/$libbase\n";
       print "Found '$path/$libbase'.\n";
       return $lib;
-    } elsif (-f $path . '/' . $libbase_so) {
+    } elsif (-f $path . '/' . $libbase) {
       print "$path/$libbase_so\n";
       print "Found `$_/$libbase_so'.\n";
       return $lib;
